<template>
	<view class="content bgGray">
		<z-paging ref="paging" v-model="dataList" @query="queryList">
			<view
				class="flex-r bgWhite jsb p16 ver-c"
				style="border-bottom: 1rpx solid #eee;"
				v-for="item of dataList"
				:key="item.tMerchantid"
			>
				<view class="f1" @tap="toInfo(item)">
					<view>{{ item.tMerchantname }}</view>
					<view class="fs13 mt10 gray">{{ item.tMerchantaddress }}</view>
				</view>
				<view>
					<view class="btn1" @tap="check(item.tMerchantid, '2')">通过</view>
					<view class="mt10 btn2" @tap="check(item.tMerchantid, '3')">驳回</view>
				</view>
			</view>
		</z-paging>
	</view>
</template>

<script>
import Utils from '@/utils/utils.js'
import { getMerchantList, checkMerchant } from '@/api/mine.js'
export default {
	data() {
		return {
			dataList: []
		}
	},
	onLoad() {
		//this.getList()
	},
	methods: {
		queryList(pageNo, pageSize) {
			getMerchantList(pageNo, pageSize).then(
				res => {
					console.log(res)
					this.$refs.paging.complete(res.rows)
				},
				err => {
					this.$refs.paging.complete(false)
				}
			)
		},
		check(tMerchantid, status) {
			let params = {
				tExaminestatus: status,
				tMerchantid: tMerchantid
			}
			checkMerchant(params).then(
				res => {
					console.log(res)
					if (res.code == 200) {
						Utils.toast(res.msg)
					} else {
						Utils.toast(res.msg)
					}
				},
				err => {
					console.log(err)
				}
			)
		},
		toInfo(item) {
			uni.navigateTo({
				url: `/pages_D/merchantInfo/merchantDetail?data=${JSON.stringify(item)}`
			})
		}
	}
}
</script>

<style lang="stylus" scoped>
.content
	min-height 100%
.btn1
	font-size 26rpx
	background #c40414
	border-radius 20rpx
	color #fff
	padding 6rpx 16rpx
.btn2
	font-size 26rpx
	border 1rpx solid #c40414
	border-radius 20rpx
	color #c40414
	padding 6rpx 16rpx
</style>
